@(uid:Long,uname:String)
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>登录注册 - 心尖偏左</title>
    <meta name="keywords" content="心尖偏左,xjpz,心尖偏左博客,xjpzblog,心尖偏左Blog,心尖依然偏左,scala+play,Scala满足了我对编程语言的所有幻想." />
    <meta name="description" content="心尖偏左Blog是一个用Scala+Play搭建的以分享知识、技术交流为目的的博客系统。博主心尖偏左是一个Scala语言的忠实粉丝，热爱Scala。" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

      <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="/assets/javascripts/jquery.min.js"></script>
    <script src="/assets/javascripts/login.js"></script>

    <link rel="stylesheet" href="/assets/stylesheets/base.css" />
    <link rel="stylesheet" href="/assets/stylesheets/login.css" >
    <link rel="shortcut icon" href="/assets/images/favicon.png" />

      <!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="/assets/stylesheets/bootstrap.min.css" />

      <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script>
      var _hmt = _hmt || [];
      (function() {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?a43a6a0c825c678693fcedd5df8e869d";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>

  </head>

  <body>
      <!-- ntopbar -->
    @blog.blog_topbar(uid,uname)

      <!-- blog -->
    <div class="bloga" id="bloga">
      @blog.blog_head()
      <div class="blogb" id="blogb">

        <div class="blogbody" id="blogbody">
          <h1>登录注册<sup>V2015</sup></h1>

          <div class="login" style="margin-top : 50px ;">

            <div class="header">
              <div class="switch" id="switch"><a class="switch_btn_focus" id="switch_qlogin" href="javascript:void(0);" tabindex="7">快速登录</a>
                <a class="switch_btn" id="switch_login" href="javascript:void(0);" tabindex="8">快速注册</a> <div class="switch_bottom" id="switch_bottom" style="position : absolute ; "></div>
              </div>
            </div>


            <div class="web_qr_login" id="web_qr_login" style="display : block ; height : 265px ;">

                <!--登录-->
              <div class="web_login" id="web_login">

                <div class="login-box">

                  <div class="login_form">
                    <form action="/blog/login?csrfToken=eb3045fb66253c51007cba739b8a440fceabacf0-1464419878394-fcd4ae359733a12e98d39e4c" name="loginform" accept-charset="utf-8" id="login_form" class="loginForm" method="post">
                      <input type="hidden" name="did" value="0"/>
                      <input type="hidden" name="to" value="log"/>
                      <div class="uinArea" id="uinArea">
                        <label class="input-tips" for="u" required="true">帐号：</label>
                        <div class="inputOuter" id="uArea">

                          <input type="text" id="u" name="name" class="inputstyle"/>
                        </div>
                      </div>
                      <div class="pwdArea" id="pwdArea">
                        <label class="input-tips" for="p" required="true" >密码：</label>
                        <div class="inputOuter" id="pArea">

                          <input type="password" id="p" name="password" class="inputstyle"/>
                        </div>
                      </div>

                      <div style="padding-left : 50px ; margin-top : 20px ;"><input type="button" value="登 录" onclick="check_login()" style="width : 135px ;" class="button_blue" id="butt_login"/><a href="/blog/reset/password" class="zcxy">忘记密码</a>
                        <br>
                        <div id="other_login" class="other_login" >
                                                    其他账户登录 :<span id="qqLoginBtn">
                          <a href="javascript:;" style="text-decoration:none;" onclick="return window.open('https://graph.qq.com/oauth2.0/authorize?client_id=101253933&amp;response_type=token&amp;scope=all&amp;redirect_uri=http%3A%2F%2Fxjpz.me%2Fblog%2Ftest%2Fqcback', 'oauth2Login_10984' ,'height=525,width=585, toolbar=no, menubar=no, scrollbars=no, status=no, location=yes, resizable=yes');">
                            <img src="/assets/images/Connect_logo_7.png" alt="QQ登录" border="0"></a></span>

                        </div>
                      </div>
                    </form>
                  </div>

                </div>

              </div>
                <!--登录end-->
            </div>

              <!--注册-->
            <div class="qlogin" id="qlogin" style="display : none ; ">

              <div class="web_login">
                <form name="form2" id="regUser" accept-charset="utf-8" action="/blog/register?csrfToken=0a08a13ca08533890b905a92ae2437a4166f3a80-1464419878395-fcd4ae359733a12e98d39e4c" method="post">
                  <input type="hidden" name="to" value="reg"/>
                  <input type="hidden" name="did" value="0"/>
                  <ul class="reg_form" id="reg-ul">
                    <div id="userCue" style="color:red;" class="cue">快速注册请注意格式！</div>
                    <li>

                      <label for="user" class="input-tips2">用户名：</label>
                      <div class="inputOuter2">
                        <input type="text" id="user" name="name" maxlength="16" class="inputstyle2" required/>
                      </div>

                    </li>

                    <li>
                      <label for="qq" class="input-tips2">邮箱：</label>
                      <div class="inputOuter2">

                        <input type="email" id="email" name="email" maxlength="20" class="inputstyle2" required/>
                      </div>

                    </li>
                    <li>
                      <label for="passwd" class="input-tips2">密码：</label>
                      <div class="inputOuter2">
                        <input type="password" id="passwd" name="password" minlength="6" maxlength="16" autocomplete="off" data-val="true" data-val-required="密码不能为空" class="inputstyle2"/>
                      </div>

                    </li>
                    <li>
                      <label for="passwd2" class="input-tips2">确认密码：</label>
                      <div class="inputOuter2">
                        <input type="password" id="passwd2" name="" maxlength="16" autocomplete="off" data-val="true" data-val-required="密码不能为空" class="inputstyle2" />
                      </div>

                    </li>

                    <li>
                      <label for="captcha" class="input-tips2">验证码：</label>
                      <div class="inputOuter2">
                        <input type="text" id="captcha" name="captcha" maxlength="6" class="inputstyle2" required="required" />
                        <img id="captchaImage" class="captchaImage" src="/blog/captcha" onclick="javascript:refresh(this)">
                      </div>

                    </li>

                    <li>
                      <div class="inputArea">
                        <input type="button" id="reg" style="margin-top : 10px ; margin-left : 85px ;" class="button_blue" onclick="check_reg()" value="同意协议并注册"/> <a href="javascript:" onclick="disp_alert()" class="zcxy" target="_blank">注册协议</a>
                      </div>

                    </li> <div class="cl"></div>
                  </ul>
                </form>

              </div>

            </div>
              <!--注册end-->
          </div>
          <div class="jianyi"></div>
        </div>

      </div>
    </div>

    @footer.index_footer(2)
  </body>

</html>

<script type="text/javascript" language="javascript">
    function disp_alert(){
      alert("协议还没有起草。但，最终解释权归本站所有。");
    }

    function qc_login(){
      window.open ("https://graph.qq.com/oauth/show?which=ConfirmPage&display=pc&client_id=101253933&response_type=token&scope=all&redirect_uri=http://xjpz.me/blog/test/qcback&scope=get_user_info",'newWindow', 'height=400, width=600, top=100, left=300, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
    }

    <!-- 验证码-->
    function refresh(obj){
      obj.src="/blog/captcha?id="+Math.random();
    }

    $(document).keydown(function(event){
      if(event.keyCode ==13){
        if($('#web_qr_login').css("display")=="block"){
          $("#butt_login").trigger("click");
        }else {
          $("#reg").trigger("click");
        }
      }
    });

    //登录校验
    function check_login(){
      var uInput = document.getElementById("u");
      var userName = $("#u").val();
      if(userName == ""){
        //      uInput.style.color="red";
        $('#u').focus();
        return;
      }

      var userpwd = $("#p").val();
      if(userpwd == ""){
        $('#p').focus();
        return;
      }

      $.post(
              "/blog/login",
              $("#login_form").serialize(),
              function(data) {
                if(data.ret==9) {

                  alert("账号不存在");
                  $('#u').focus();
                  change();
                } else if(data.ret==8) {

                  alert("账号或密码错误");
                  $('#u').focus();

                }else if(data.ret == 2){
                  alert("服务器错误!");
                } else {

                  var url = window.location.search;
                  var returnUrl = url.substring(url.indexOf('=')+1, url.length);
                  if(returnUrl==""){
                    location.href = "/";
                  }else{
                    location.href = returnUrl;
                  }

                }
              }
      );

    }

    //注册校验
    function check_reg() {
      var userCue= document.getElementById("userCue");
      var code = $("#captcha").val();
      if(code == "") {
        userCue.style.color="red";
        userCue.innerHTML = "<b>×请输入验证码.</b>";
        $('#captcha').focus();
        return;
      }

      var uname = $("#user").val();
      if(uname == "") {
        userCue.style.color="red";
        userCue.innerHTML = "<b>×请输入用户名.</b>";
        $('#user').focus();
        return;
      }else if(uname.length <2){
        userCue.style.color="red";
        userCue.innerHTML = "<b>×请输入正确的用户名.</b>";
        $('#user').focus();
        return
      }

      var pattern = /^([\.a-zA-Z0-9_-])+@@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;

      var email = $("#email").val();
      if(email == "") {
        userCue.style.color="red";
        userCue.innerHTML = "<b>×请输入邮箱.</b>";
        $('#email').focus();
        return;
      }

      if (!pattern.test(email)) {
        userCue.style.color="red";
        userCue.innerHTML = "<b>×请输入正确的邮箱.</b>";
        $('#email').focus();
        return;
      }

//                    var regphone = /^0?1[3|4|5|8][0-9]\d{8}$/;
//                    var phone = $("#phone").val();

//                    if(phone == "") {
//                        userCue.style.color="red";
//                        userCue.innerHTML = "<b>×请输入手机号.</b>";
//                        $('#phone').focus();
//                        return;
//                    }else if(phone.length !=11){
//                        userCue.style.color="red";
//                        userCue.innerHTML = "<b>×请输入正确的手机号.</b>";
//                        $('#phone').focus();
//                        return;
//                    }else if(!regphone.test(phone)){
//                        userCue.style.color="red";
//                        userCue.innerHTML = "<b>×请输入正确的手机号.</b>";
//                        $('#phone').focus();
//                        return;
//                    }

      var password = $("#passwd").val();
      if(password == "") {
        userCue.style.color="red";
        userCue.innerHTML = "<b>×请输入密码.</b>";
        $('#passwd').focus();
        return;
      }else if(password.length <6){
        userCue.style.color="red";
        userCue.innerHTML = "<b>×请输入大于6位的密码.</b>";
        $('#passwd').focus();
        return;
      }

      var passwd2 = $("#passwd2").val();
      if(passwd2 !=$("#passwd").val()) {
        userCue.style.color="red";
        userCue.innerHTML = "<b>×两次密码不一致.</b>";
        $('#passwd2').focus();
        return;
      }

      $.post(
              "/blog/register",
              $("#regUser").serialize(),
              function(data) {
                if(data.ret==6) {
                  userCue.style.color="red";
                  userCue.innerHTML = "<b>×验证码错误.</b>";
                  $('#captcha').focus();
                  change();
                } else if(data.ret==11) {
                  userCue.style.color="red";
                  userCue.innerHTML = "<b>×用户名已存在.</b>";
                  $('#user').focus();
                } else if(data.ret==13) {
                  userCue.style.color="red";
                  userCue.innerHTML = "<b>×手机号已注册.</b>";
                  $('#phone').focus();
                }else if(data.ret==12) {
                  userCue.style.color="red";
                  userCue.innerHTML = "<b>×邮箱已注册.</b>";
                  $('#email').focus();
                } else {
                  alert("恭喜，注册成功！");
                  location.href = "/";
                }
              }
      );
    }
    //设置提示信息
    function set_msg(id, msg) {
      $("#"+id).text(msg);
    }
    //刷新验证码
    function change() {
      $("#captchaImage").attr("src", "/blog/captcha?id=" + new Date().getTime());
    }
            </script>



<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"1","bdMiniList":["mshare","qzone","tsina","weixin","tieba","sqq","mail","copy","print"],"bdPic":"","bdStyle":"0","bdSize":"16"},"slide":{"type":"slide","bdImg":"1","bdPos":"right","bdTop":"128"},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到：","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
